package com.kmust.dream.wanderingdream.product.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import com.google.gson.Gson;
import lombok.Data;

/**
 * 
 * @TableName product_property_name
 */
@TableName(value ="product_property_name")
@Data
public class ProductPropertyName implements Serializable {
    /**
     * 商品属性id
     */
    @TableId(value = "product_property_name_id", type = IdType.AUTO)
    private Integer productPropertyNameId;

    /**
     * 商品种类id
     */
    @TableField(value = "product_category_id")
    private Integer productCategoryId;

    /**
     * 商品属性名称
     */
    @TableField(value = "product_property_title")
    private String productPropertyTitle;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductPropertyName other = (ProductPropertyName) that;
        return (this.getProductPropertyNameId() == null ? other.getProductPropertyNameId() == null : this.getProductPropertyNameId().equals(other.getProductPropertyNameId()))
            && (this.getProductCategoryId() == null ? other.getProductCategoryId() == null : this.getProductCategoryId().equals(other.getProductCategoryId()))
            && (this.getProductPropertyTitle() == null ? other.getProductPropertyTitle() == null : this.getProductPropertyTitle().equals(other.getProductPropertyTitle()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getProductPropertyNameId() == null) ? 0 : getProductPropertyNameId().hashCode());
        result = prime * result + ((getProductCategoryId() == null) ? 0 : getProductCategoryId().hashCode());
        result = prime * result + ((getProductPropertyTitle() == null) ? 0 : getProductPropertyTitle().hashCode());
        return result;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}